function(tensor_test name)
    add_executable(${name} ${name}.cpp)
    link_tensor(${name})
    install(TARGETS ${name}
        RUNTIME DESTINATION tests)
endfunction()

set_test_c_cxx_flags()

if (BUILD_TEST)
    tensor_test(test_activation)
    tensor_test(test_argmax)
    tensor_test(test_attention)
    tensor_test(test_check)
    tensor_test(test_clip)
    tensor_test(test_concat)
    tensor_test(test_convolution)
    tensor_test(test_deconvolution)
    tensor_test(test_depthwise_convolution)
    tensor_test(test_dilated_convolution)
    tensor_test(test_detectionoutput)
    tensor_test(test_eltwise)
    tensor_test(test_fully_connected)
    tensor_test(test_rnn)
    tensor_test(test_power)
    tensor_test(test_reduction)
    tensor_test(test_pooling)
    tensor_test(test_pooling_bp)
    tensor_test(test_padding)
    tensor_test(test_priorbox)
    tensor_test(test_reshape)
    tensor_test(test_softmax)
    tensor_test(test_split)
    tensor_test(test_slice)
    tensor_test(test_scale)
    tensor_test(test_transpose)
    tensor_test(test_expand)
    tensor_test(test_non_max_suppression)
    tensor_test(test_roialign)
    tensor_test(test_l2norm)
    tensor_test(test_prelu)
    tensor_test(test_layer_norm) 
    tensor_test(test_tile) 
    
    tensor_test(test_matmul_int8)
    tensor_test(test_fully_connected_int8)
    tensor_test(test_convolution_int8)
    tensor_test(test_depthwise_convolution_int8)
    tensor_test(test_concat_int8)
    tensor_test(test_pooling_int8)
    tensor_test(test_convolution_bnn)
    
    if (USE_GPU)
        tensor_test(test_matmul_ocl_f32 test_matmul_ocl_f32.cpp)
        tensor_test(test_convolution_ocl test_convolution_ocl.cpp)
        tensor_test(test_deconvolution_ocl test_deconvolution_ocl.cpp)
        tensor_test(test_channel_resize_ocl test_channel_resize_ocl.cpp)
        tensor_test(test_depthwise_convolution_ocl test_depthwise_convolution_ocl.cpp)
        tensor_test(test_depthwise_pointwise_convolution_ocl test_depthwise_pointwise_convolution_ocl.cpp)
        tensor_test(test_fully_connected_ocl test_fully_connected_ocl.cpp)
        #tensor_test(test_multihead_attention_ocl test_multihead_attention_ocl.cpp)
        tensor_test(test_padding_ocl test_padding_ocl.cpp)
        tensor_test(test_prelu_ocl test_prelu_ocl.cpp)
        tensor_test(test_pooling_ocl test_pooling_ocl.cpp)
        tensor_test(test_softmax_ocl test_softmax_ocl.cpp)
        tensor_test(test_power_ocl test_power_ocl.cpp)
        tensor_test(test_transpose_ocl test_transpose_ocl.cpp)
        tensor_test(test_concat_ocl test_concat_ocl.cpp)
        tensor_test(test_reshape_ocl test_reshape_ocl.cpp)
        tensor_test(test_reduction_ocl test_reduction_ocl.cpp)
        tensor_test(test_matmul_ocl test_matmul_ocl.cpp)
        tensor_test(test_topk_ocl test_topk_ocl.cpp)
        tensor_test(test_tfslice_ocl test_tfslice_ocl.cpp)
        tensor_test(test_eltwise_ocl test_eltwise_ocl.cpp)
        tensor_test(test_rnn_ocl test_rnn_ocl.cpp)
        tensor_test(test_rnncell_ocl test_rnn_ocl.cpp)
        tensor_test(test_slice_ocl test_slice_ocl.cpp)
        tensor_test(test_tile_ocl test_tile_ocl.cpp)
        tensor_test(test_generate_proposals_ocl test_generate_proposals_ocl.cpp)
        tensor_test(test_roialign_ocl test_roialign_ocl.cpp)
        tensor_test(test_scale_ocl test_scale_ocl.cpp)
        tensor_test(test_gather_ocl test_gather_ocl.cpp)
    endif ()
endif ()
